package May;

import java.util.Scanner;

public class Test04While_02 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true){
            try {
                Scanner_using(sc);
            } catch (Exception e) {
                System.out.println("您输入了一个意外的数字（不能带有小数）");
                Scanner_using(sc);
            }
            System.out.println("程序继续执行");
        }
    }

    public static void Scanner_using(Scanner sc) {
        System.out.println("请输入一个数字我将判断他的位数，并且将他反过来写");
        int number = sc.nextInt();
        int count = 0;
        int temp = number;
        int i = 0;
        while (number != 0) {
            int ge = number % 10;
            number = number / 10;
            count = count * 10 + ge;
            i++;
        }
        System.out.println("这个数是" + i + "位数，" + "反过来写的结果是：" + count);
        if (temp == count) {
            System.out.println("该数字反过来写之后与原数字完全相同1");
        }else {
            System.out.println("该数字反过来写之后与原数字不相同2");
        }
    }


}
